﻿//----------------------------------------------------

#region 命名空间

//    版权：
//    作者：
//建立时间：2012-09-11 00:00:33
//    描述：
//----------------------------------------------------
using System;
using System.Data;
using System.Text;
using WinnerCMS.Data;
using WinnerCMS.Model;
using WinnerCMS.Common;

#endregion

namespace WinnerCMS.BLL
{
    /// <summary>
    /// 业务逻辑类 WinnerCMS_CounterContent 的摘要说明。
    /// </summary>
    public class CounterContentManage
    {
        private static readonly CounterContentDal Dal = new CounterContentDal();

        #region 添加

        /// <summary>
        /// 添加
        /// </summary>
        public void Add(CounterContent model)
        {
            Dal.Add(model);
        }

        #endregion

        #region 修改

        /// <summary>
        /// 修改
        /// </summary>
        public void Edit(CounterContent model)
        {
            Dal.Edit(model);
        }

        #endregion

        public CounterContent GetInfo()
        {
            CounterContent info = Dal.GetInfo();
            if (info == null)
            {
                CounterContent model = new CounterContent
                {
                    Today = 0,
                    Yesterday = 0,
                    Date = DateTime.Now.Date,
                    Total = 0,
                    StartTime = DateTime.Now,
                    High = 0,
                    HighTime = DateTime.Now.Date
                };

                Add(model);

                return info;
            }
            return info;
        }
    }
}